package com.game.tankwar;

/*
 * description: tank class
 * author: Cheng
 * Date: 09-03-2020
 * */
public class Tank {
    /* tank id */
    private String tankId;

    /* set the position of tank by X */
    private int positionX;

    /* set the position of tank by Y */
    private int positionY;

    //构造函数
    public Tank() {
    }

    public Tank(String tankId, int positionX, int positionY) {
        this.tankId = tankId;
        this.positionX = positionX;
        this.positionY = positionY;
    }

    /*
     * description: make the tank moving
     * @Param: x, y
     * @return: null
     * */
    public void move(int x, int y){
        System.out.println("The tank is moving now " + formatPosition(x,y));
    }

    /*
     * description: inform the system center the location of the tank
     * @Param: x, y
     * @return: String
     * */
    public String moving(int x, int y){
        String sayMyPosition = "This is my location " + formatPosition(x,y);
        return sayMyPosition;
    }

    /*
     * description: format the location data
     * @Param: x, y
     * @return: String
     * */
    public String formatPosition(int x,int y){
        return "(" + x + "," + y + ")" ;
    }

    public void move(){
        System.out.println("The tank is moving now ");
    }
}